<div class="right_side_operate_area">
	<div class="right_side_title left">
    	<h2>
    	<?php 
		$companyname=$user['User']['username'];
		$companyid=$user['User']['cid'];
		$dan='"';
		echo $html->link($companyname,"/companys/showinfosummary/".$companyid);
		?>
		</h2>
    </div>
    <div class="right item_add_btn">
    	<?php echo $html->link(__('Change Password',true),"/companys/changepwd/"); ?>
    </div>
    <div class="clear"></div>
</div>
<div class="right_side_scollbar">
	<div class="detail_info_panel">
		<div class="user_info_details">
			<div class="user_info_portrait left">
				<?php  echo $form->hidden('User.id',array('value'=>$user['User']['id'])); ?>
				<?php 
				if($attachment['Attachment']['file_path']){
					echo $html->image("/".$attachment['Attachment']['file_path']);
				}else{ echo $html->image('men_large.jpg'); }
				
				?>
				<div class="change_portrait">
					<a onclick="toggle()" href="javascript:void(0);">更换头像</a>
					<div id="photo_file"  style="display:none;">
					  <?php echo $form->create('User', array('action' => 'editphoto','type'=> 'post','id' => 'addform','name' => 'form','enctype'=>'multipart/form-data')); ?>
					    <?php echo $form->hidden('User.id',array('value'=> $user['User']['id']));?>
						<input type="file" id="upload[]" name="upload[]">
					 <?php echo $form->submit("上传", array("id"=>"addfile","name"=>"submit","class"=>"buttom","div"=>false,'onsubmit' => 'return checkpic()'));?>
					</div>
				</div>
			</div>
			<div class="user_info_desc">
				<div class="details_item_line">
				    <div class="details_item">
				        <div class="form_left_title left"><?php echo "所在部门" ;?>：</div>
				        <div class="form_right_input left"><?php echo $group['Group']['group_name'] ;?></div>
				    </div>  
				</div>
				<div class="details_item_line">
				    <div class="details_item">
				        <div class="form_left_title left"><?php echo __('Position') ;?>：</div>
				        <div class="form_right_input left"><?php echo $form->text('User.position',array('value' => $user['User']['position'],'onchange'=>'return changeuser(this,'.$dan.'pcontent'.$dan.')'));?></div>
				    </div>  
				</div>
				<div class="details_item_line">
				   <div class="details_item">
				        <div class="form_left_title left"><?php echo __('Tel') ;?>：</div>
				        <div class="form_right_input left"><?php echo $form->text('User.tel',array('value' => $user['User']['tel'],'onchange'=>'return changeuser(this,'.$dan.'tcontent'.$dan.')'));?></div>
				    </div>
				</div>
				<div class="details_item_line">
				   <div class="details_item">
				        <div class="form_left_title left"><?php echo __('Mail') ;?>：</div>
				        <div class="form_right_input left"><?php echo $form->text('User.mail',array('value'=>$user['User']['mail'],'onchange'=>'return changeuser(this,'.$dan.'mcontent'.$dan.')'));?></div>
				        <div id='mailmessage' style='display:none;' class="error_message">邮箱格式不正确</div> 
				    </div>
				</div>
				<div class="details_item_line">
				   <div class="details_item">
				        <div class="form_left_title left"><?php echo __('Address') ;?>：</div>
				        <div class="form_right_input left"><?php echo $form->text('User.address',array('value'=>$user['User']['address'],'onchange'=>'return changeuser(this,'.$dan.'acontent'.$dan.')'));?></div>
				    </div>
				</div>
			</div>
		</div>
	</div>
</div>
<script>
var webpath=$("#getpath").attr('href');
function changeuser(obj,content)
{
	var userid = $("#UserId").val();
	var contentvalue = obj.value.trim();
	if(content=="mcontent"){
		if(content){
  			var search_str = /\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/;
    	 	if(!search_str.test(contentvalue)){
	    	 	$("#mailmessage").css('display','block');
	    	 	return false;
       		}
	  		else{
	   			$("#mailmessage").css('display','none');
	  		}
	  	}
	}
	$.ajax({     	   
	    	url: webpath+'/users/edit?userid='+encodeURI(userid)+'&'+content+'='+encodeURIComponent(contentvalue), 
	        success:function(data){
	        	showmessage("用户信息保存成功");
	        }       
	     });
	return true;
}
function checkpic(){
	if($("#upload[]").val() == ''){
		showmessage('请选择图片',"F");
		return false;
	}
}
function toggle(){
	$("#photo_file").toggle();
}
</script>